MaxSize=100                             
class SqQueue:      			       
    def __init__(self):               
        self.data = [None]*MaxSize       
        self.front = -1                   
        self.rear = -1                   
    def empty(self):				   
        return self.front == self.rear
    def push(self,e):				   
        assert not self.rear == MaxSize - 1     
        self.rear += 1
        self.data[self.rear] = e
    def pop(self):						
        assert not self.empty()         
        self.front += 1
        return self.data[self.front]    
    def gethead(self):
        assert not self.empty()
        return self.data[self.front+1]
    
class CsqQueue:
    def __init__(self):
        self.data = [None]*MaxSize
        self.front = 0
        self.rear = 0

    def empty(self):
        return self.front == self.rear
    
    def push(self, e):
        assert (self.rear + 1) % MaxSize != self.front
        self.rear = (self.rear + 1) % MaxSize
        self.data[self.rear] = e

    def pop(self):
        assert not self.empty()
        self.front = (self.front + 1) % MaxSize
        return self.data[self.front]

    def gethead(self):
        assert not self.empty()
        head = (self.front + 1) % MaxSize
        return self.data[head]
    
    def size(self):#使用取余操作比判断大小更优美
        return (self.rear - self.front + MaxSize) % MaxSize
        


        


